<?php

class pictureModel{
	private $db;
	private $ecs;
	public function __construct(){
		$this->db = $GLOBALS['db'];
		$this->ecs = $GLOBALS['ecs'];
	}
	
	public function insert_pic($info){
		
	    
	    $news = array();
	    $news['content'] = $info['desc'];
	    $news['create_time'] =$info['create_time'];
	    $news['create_id'] = $info['create_id'];
	    
	    
	    $news_id = insert($news,"news");
	    
	    if($news_id)
	    foreach ($info['pic']['img'] as $k => $v)
	    {
	        $news_img = array();
	        $news_img['news_id'] = $news_id;
	        $news_img['img'] = $v;
	        $news_img['thumb'] = $info['pic']['thumb'][$k];
	        
	        insert($news_img, "news_img");
	    }
	    
	    return $news_id;
	}
}